import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { MallRegionalVO, MallRegionalForm, MallRegionalQuery } from '@/api/mall/mallRegional/types';

/**
 * 查询区域信息列表
 * @param query
 * @returns {*}
 */

export const listMallRegional = (query?: MallRegionalQuery): AxiosPromise<MallRegionalVO[]> => {
  return request({
    url: '/mall/mallRegional/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询区域信息详细
 * @param id
 */
export const getMallRegional = (id: string | number): AxiosPromise<MallRegionalVO> => {
  return request({
    url: '/mall/mallRegional/' + id,
    method: 'get'
  });
};

/**
 * 新增区域信息
 * @param data
 */
export const addMallRegional = (data: MallRegionalForm) => {
  return request({
    url: '/mall/mallRegional',
    method: 'post',
    data: data
  });
};

/**
 * 修改区域信息
 * @param data
 */
export const updateMallRegional = (data: MallRegionalForm) => {
  return request({
    url: '/mall/mallRegional',
    method: 'put',
    data: data
  });
};

/**
 * 删除区域信息
 * @param id
 */
export const delMallRegional = (id: string | number | Array<string | number>) => {
  return request({
    url: '/mall/mallRegional/' + id,
    method: 'delete'
  });
};
/**
 * 恢复区域信息
 * @param id
 */
export const recoverRegionalInfo = (id: string | number | Array<string | number>) => {
  return request({
    url: '/tearoom/mallRegional/recover/' + id,
    method: 'put'
  });
};

/**
 * 永久删除区域信息
 * @param id
 */
export const foreverDeleteRegionalInfo = (id: string | number | Array<string | number>) => {
  return request({
    url: '/tearoom/mallRegional/foreverDelete/' + id,
    method: 'delete'
  });
};
